<?php
session_start();
$raizController = dirname(__FILE__);

require_once "$raizController/../config.php";

$em->getConnection()->beginTransaction();

$dql = "select r from Entities\Referencia r order by r.id";

$referencias = $em->createQuery($dql)->getResult();


foreach ($referencias as $r){
	echo "{$r->getId()} <br />";
	
	$r->setMesFinal($r->getMes());
	$r->setAnoFinal($r->getAno());
	
	$em->persist($r);
	
}


try {
	$em->flush();
	$em->getConnection()->commit();
} catch (Exception $e) {
	echo $e->getMessage();
	$em->getConnection()->rollback();
}